<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:o="http://omnifaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:sec="http://www.springframework.org/security/facelets/tags">
<f:view contentType="text/html">
	<style>
body {
	background: url(#{request.contextPath}/include/images/admin/login-bg.png);
	font-size: 12px;
}
</style>
	<ui:param name="servletPath"
		value="#{requestScope['javax.servlet.forward.servlet_path']}"></ui:param>
	<ui:param name="path" value="#{request.contextPath}"></ui:param>

	<h:head>
		<f:facet name="first">
			<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
			<title>我要吃饭</title>
		</f:facet>

		<link type="text/css" rel="stylesheet"
			href="#{request.contextPath}/include/css/default.css" />
		<link type="text/css" rel="stylesheet"
			href="#{request.contextPath}/include/css/admin.css" />
		<script type="text/javascript" charset="utf-8">
			window.CONTEXT_PATH = "#{request.contextPath}";
		</script>
		<script type="text/javascript" charset="utf-8"
			src="#{request.contextPath}/include/js/ueditor1_3_6-utf8-jsp/ueditor.config.js"></script>
		<script type="text/javascript" charset="utf-8"
			src="#{request.contextPath}/include/js/ueditor1_3_6-utf8-jsp/ueditor.all.min.js"></script>
		<script
			src="#{request.contextPath}/include/js/datepicker-primefaces.js"></script>
		<script type="text/javascript" charset="utf-8"
			src="#{request.contextPath}/include/js/fileupload.ori.js"></script>
		<link rel="stylesheet" type="text/css"
			href="#{request.contextPath}/include/css/fileupload.ori.css" />
			
			
		<link href="#{request.contextPath}/include/images/admin/favicon.png"
			type="image/x-icon" rel="shortcut icon" />

		<script type="text/javascript" charset="utf-8"
			src="#{request.contextPath}/include/js/jquery.artDialog.js?skin=blue"></script>


		<ui:insert name="head"></ui:insert>

		<script type="text/javascript">
			$(function() {

				var currentUrl = window.location.pathname
						+ window.location.search;
				$("#sidebar li a[href='" + currentUrl + "']").addClass(
						"ui-state-highlight");
				//.addClass("ui-state-highlight"); li a [href=/jdp2p4/admin/loan/loanList.htm?loanStatus=WAITING_VERIFY]
				//alert($("#sidebar li a[href='"+currentUrl+"']").size());
				// 增加表格行鼠标经过样式
				$(".ui-datatable-data tr").mouseover(function() {
					$(this).addClass("ui-state-hover");
				});
				$(".ui-datatable-data tr").mouseout(function() {
					$(this).removeClass("ui-state-hover");
				});
				//ui-state-hover  border-left: solid 5px #c0c0c0;
			});
		</script>
		<style>
#sidebar li {
	height: 20px;
	font-weight: bold;
	border-bottom: solid 1px #c0c0c0;
	color: #878787;
	font-family: "微软雅黑";
}

.ui-panelmenu .ui-menuitem {
	width: 99%;
}
</style>
	</h:head>

	<h:body>
		<p:growl autoUpdate="true" showDetail="true" showSummary="false"
			severity="info,error"></p:growl>
		<div id="header" style="color: rgb(255,254,239);">
<!-- 		<div id="header" class="ui-widget ui-widget-header" style="color: rgb(255,254,239);"> -->
			<div id="logo">
				<img src="#{request.contextPath}/include/images/admin/logo.png"
					style="cursor: pointer;height: 40px;"
					onclick="window.location.href='#{request.contextPath}/admin/';" />
			</div>
			<h:form id="form1">
				<div id="menu" class="ui-widget">
					<ul id="main">
						<li class="system-home"><a
							href="#{request.contextPath}/admin/">主页</a></li>
						<li class="my-key">
							<h:commandLink rendered="#{loginUserInfo.loginUser.duser.bindStatus ne '1'}" actionListener="#{userHome.toALiDingDing('bind')}" value="绑定钉钉"></h:commandLink>
							<h:commandLink rendered="#{loginUserInfo.loginUser.duser.bindStatus eq '1'}" actionListener="#{userHome.unBindDingDing(loginUserInfo.loginUserId, false)}" value="解绑钉钉"></h:commandLink>
						</li>
						
						<li class="my-key"><a
							href="#{request.contextPath}/admin/user/modifyPassword.htm">密码修改</a>
						</li>
						<li class="my-key"><a
							href="#{request.contextPath}/admin/dont.htm">投诉我啊</a>
						</li>
						<li class="logout"><a
							href="#{request.contextPath}/user/logout">注销[#{loginUserInfo.loginUser.realname}]</a>
						</li>
					</ul>
				</div>
			</h:form>
		</div>


		<h:form>
			
				<c:forEach var="menu" items="#{menuList.getManagementMenus()}"
					varStatus="status">
					<c:if test="#{status.first}">
						<c:set var="menuPid" value="#{menu.id}"></c:set>
						<!-- 默认为选中第一个菜单 -->
					</c:if>
					<c:if test="#{menu.id == loginUserInfo.selectMenuId}">
						<c:set var="menuPid" value="#{menu.id}"></c:set>
						<c:set var="activeIndex" value="#{status.index}"></c:set>
					</c:if>
				</c:forEach>
				<p:tabMenu widgetVar="tabMenu" activeIndex="#{activeIndex}" style="background:#EEEEEE;"> 
					<c:forEach var="menu" items="#{menuList.getManagementMenus()}"
						varStatus="status">
						<h:outputLabel value="#{menu.permissionsCommaStr}"></h:outputLabel>
						<sec:ifAnyGranted roles="#{menu.permissionsCommaStr}">
							<p:menuitem value="#{menu.label}" style="background-color:transparent;"
								actionListener="#{loginUserInfo.selectMenu(menu.id)}"></p:menuitem>
						</sec:ifAnyGranted>
					</c:forEach>
				</p:tabMenu>

		</h:form>

		<div id="page" class="ui-widget">
			<div id="sidebar" style="background:transparent;">
				<!-- 			<div id="sidebar" -->
				<!-- 				class="ui-widget-content ui-corner-bottom ui-helper-clearfix ui-shadow"> -->
				<p:accordionPanel style="min-height:500px;background-color:transparent;"
					activeIndex="0,1,2,3,4,5,6,7,8,9" multiple="true" >
					<p:ajax event="tabChange"
						listener="#{managementMenuBean.onTabChange}" />

					<c:forEach var="menu"
						items="#{menuList.getMenusByParentId(menuPid)}">
						<h:outputLabel value="#{menu.permissionsCommaStr}" ></h:outputLabel>
						<sec:ifAnyGranted roles="#{menu.permissionsCommaStr}">
							<p:tab title="#{menu.label}" rendered="#{menu.enable == '1'}" titleStyle="background:transparent;">
								<ul>
									<c:forEach var="m2" items="#{menu.children}">
										<c:if test="#{m2.enable == '1'}">
											<c:set var="roles" value="#{m2.permissionsCommaStr}"></c:set>
											<sec:ifAnyGranted roles="#{roles}">
												<li style="background:transparent;"><a href="#{request.contextPath}#{m2.url}"  style="color: rgb(8,46,111);background:transparent;">#{m2.label}</a>
												</li>
											</sec:ifAnyGranted>
										</c:if>
									</c:forEach>
								</ul>
							</p:tab>
						</sec:ifAnyGranted>
					</c:forEach>

				</p:accordionPanel>
			</div>






			<div id="content">
				<div class="post">
					<ui:insert name="content">...</ui:insert>
				</div>
			</div>

			<div style="clear: both;"></div>
		</div>

		<div id="footer" style="position:fixed;bottom:0;">
			<p class="copyright">
				Running 技术部订餐用的 on Java6<br /> (c) Copyright 食堂大爷

			</p>
		</div>

		<ui:insert name="status">
			<p:ajaxStatus
				style="width:64px;height:64px;position:fixed;right:5px;bottom:5px">
				<f:facet name="start">
					<p:graphicImage value="/include/images/loading.gif" />
				</f:facet>

				<f:facet name="complete">
					<h:outputText value="" />
				</f:facet>
			</p:ajaxStatus>
		</ui:insert>
		<h:form>
			<p:poll interval="10" oncomplete="initNoticeDialog()"
				rendered="#{configHome.getConfigValue('admin_notice') eq '1'}"
				process="@this" update=":notice" global="false" />
		</h:form>
		<h:panelGroup id="notice">
			<ui:repeat var="n" value="#{noticeHome.noticePool.list}">
				<h:outputText value="#{n.message}"></h:outputText>
				<br />
			</ui:repeat>
		</h:panelGroup>
		<script>
			//<![CDATA[
			function initNoticeDialog() {
				if ($('#notice').html()) {
					art.dialog({
						id : 'msg',
						content : document.getElementById('notice'),
						width : 320,
						height : 240,
						left : '100%',
						top : '100%',
						fixed : true,
						drag : false,
						resize : false,
						init : function() {
							var that = this, i = 5;
							var fn = function() {
								that.title('通知(' + i + ')');
								!i && that.close();
								i--;
							};
							timer = setInterval(fn, 1000);
							fn();
						},
						close : function() {
							clearInterval(timer);
						}
					})
				}
			}

			initNoticeDialog();
			//]]>
		</script>
	</h:body>

</f:view>
</html>